package com.money.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.nfc.Tag;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

public class Config extends AppCompatActivity {
    private static final String TAG = "Config";
        EditText edit1,edit2,edit3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_config);
        EditText edit1 = findViewById(R.id.dollar);
        EditText edit2 = findViewById(R.id.euro);
        EditText edit3 = findViewById(R.id.won);
        //处理接收的数据
        Intent intent=getIntent();
        float dollar2=intent.getFloatExtra("dollar_key",0.0f);
        float euro2=intent.getFloatExtra("euro_key",0.0f);
        float won2=intent.getFloatExtra("won_key",0.0f);

        Log.i(TAG,"onCreate:dollar2="+dollar2);
        Log.i(TAG,"onCreate:euro2="+euro2);
        Log.i(TAG,"onCreate:won2="+won2);

        edit1.setText(String.valueOf(dollar2));
        edit2.setText(String.valueOf(euro2));
        edit3.setText(String.valueOf(won2));



    }
    public void reset(View v){
        Float get1 = Float.parseFloat(edit1.getText().toString());
        Float get2 = Float.parseFloat(edit2.getText().toString());
        Float get3 = Float.parseFloat(edit3.getText().toString());
        Intent intent1=getIntent();
        Bundle bundle=new Bundle();

        bundle.putFloat("get1",get1);
        bundle.putFloat("get2",get2);
        bundle.putFloat("get3",get3);
        intent1.putExtras(bundle);

        setResult(1,intent1);
        finish();


    }
}